import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import router from './router'
import App from './App.vue'
import axios from './utils/axios'
import { permission, role, admin } from './directives/permission'

const app = createApp(App)
const pinia = createPinia()

app.use(pinia)
app.use(ElementPlus, {
    locale: zhCn,
})
app.use(router)

// 注册权限指令
app.directive('permission', permission)
app.directive('role', role)
app.directive('admin', admin)

// 全局挂载axios
app.config.globalProperties.$http = axios

app.mount('#app')
